//
//  PasswordTableViewController.m
//  1243
//
//  Created by 杨森 on 16/5/11.
//  Copyright © 2016年 1243. All rights reserved.
//

#import "PasswordTableViewController.h"
#import "ReplaceViewController.h"

@interface PasswordTableViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)NSArray *passwordArray;

@end


@implementation PasswordTableViewController

- (NSArray *)passwordArray
{
    if (!_passwordArray) {
        _passwordArray = @[@"重置登录密码",@"重置支付密码"];
    }
    return _passwordArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"密码设置";
    
    [self addTableView];
}

- (void)addTableView
{
    self.edgesForExtendedLayout = UIRectEdgeNone;
    
    UITableView *PassTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WEITH, HEIGHT) style:UITableViewStyleGrouped];
    [self.view addSubview:PassTableView];
    PassTableView.delegate = self;
    PassTableView.dataSource = self;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        return self.passwordArray.count;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier=@"passwordCell";
    
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (cell==nil) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    cell.textLabel.text = [NSString stringWithFormat:@"%@",self.passwordArray[indexPath.row]];
    cell.textLabel.font = [UIFont systemFontOfSize:15];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ReplaceViewController *replace = [[ReplaceViewController alloc] init];
    replace.titleName = self.passwordArray[indexPath.row];
    [self pushForm:self.navigationController pushToAndHidden:replace];
}

//tabBar 隐藏
- (void)pushForm:(UINavigationController *)pushForm pushToAndHidden:(UIViewController *)pushToVC
{
    [pushToVC setHidesBottomBarWhenPushed:YES];
    [pushForm pushViewController:pushToVC animated:YES];
    
}

@end
